/** @file PhysicsComponent.h
    @class PhysicsComponent
    @brief Class that represents the physics representation of each game object

    Each game object that is affected by the physics engine has a physics component.
*/
#include "stdafx.h"

#ifndef _PhysicsComponent_h_
#define _PhysicsComponent_h_

#include "Physics\Dynamics\Entity\hkpEntity.h"
#include "PhysicsSystem.h"

class PhysicsComponent {
public:
	/**
	 *	@brief Constructor
	 */
	PhysicsComponent();

	/**
	 *	@brief Destructor
	 */
	~PhysicsComponent();

	Ogre::Vector3 getPosition();
	void addToWorld(PhysicsSystem* hu);
	bool isFresh();
	void setOffset(Ogre::Vector3 offset);
	Ogre::Quaternion getOrientation();
	void applyImpulse(Ogre::Vector3 impulse);
	virtual void setGravityTowards(float deltaTime, Ogre::Vector3 point);
	bool shouldUpdateOrientation();
	void synchPositionAndOrientation(Ogre::Vector3 position, Ogre::Quaternion orientation);

protected:
	/**
	 *	@brief The rigid body of the physics component.
	 */
	hkpRigidBody* m_rigidBody;

	/**
	 *	@brief If the physics component is new it is true.
	 */
	bool m_fresh;

	/**
	 *	@brief If the orientation needs to be updated.
	 */
	bool m_updateOrientation;

private:
	/**
	 *	@brief The physics component's offseting from the centre point of the game object.
	 */
	Ogre::Vector3 m_offset;
};

#endif //_PhysicsComponent_h